package homework.work2;

public class Cat implements Comparable<Cat>{
    int age;
    String name;
    double price;



    //构造器
    public Cat(int age, String name, double price) {
        this.age = age;
        this.name = name;
        this.price = price;
    }

    //打印
    @Override
    public String toString() {
        return "Cat{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", price=" + price +
                '}';
    }

    //按年龄升序比较
    @Override
    public int compareTo(Cat o) {
        return this.age-o.age;
    }
}
